package com.medical.device.controller;

import com.medical.device.common.R;
import com.medical.device.entity.Demo;
import com.medical.device.entity.Test;
import com.medical.device.service.IDemoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yy
 * @since 2020-02-20
 */
@Api(tags = "demo示例")
@RestController
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    IDemoService iDemoService;

    @ApiOperation(value = "获取信息", response = Test.class)
    @GetMapping("/{id}")
    public ResponseEntity getById(@PathVariable("id") Integer id) {

        Demo demo = iDemoService.getById(id);

        return ResponseEntity.ok(R.success(demo));
    }
}

